* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    position: relative;
    background-color: #f8f9fa;
    color: #333;
    margin: 0;
    padding: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 768px;
    margin: 0 auto;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
    overflow: hidden; /* 确保不会出现双滚动条 */
}

header {
    color: white;
    padding: 15px;
    text-align: center;
    background-color: #1976D2;
    flex-shrink: 0;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: none; /* 默认隐藏 */
}

.header-top {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.header-top h1 {
    font-size: 18px;
    font-weight: 500;
}

.toggle-header-btn {
    position: absolute;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.header-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.header-collapsible.open {
    max-height: 150px;
}

.subtitle {
    font-size: 14px;
    margin-top: 10px;
    opacity: 0.8;
}

.header-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 12px;
}

.new-conversation-btn, .reload-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 13px;
    cursor: pointer;
}

.feature-controls {
    display: flex;
    justify-content: center;
    margin-top: 12px;
}

.toggle-container {
    display: flex;
    align-items: center;
    color: white;
    font-size: 13px;
    cursor: pointer;
}

.toggle-container input {
    margin-right: 6px;
}

/* 使用绝对定位解决滚动问题 */
.chat-container {
    position: absolute;
    top: 0; /* 如果有header，则修改为header高度 */
    bottom: 64px; /* 增加底部控制栏的高度，确保不重叠 */
    left: 0;
    right: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 15px;
    padding-bottom: 15px;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
    background-image: linear-gradient(to bottom, rgba(255,255,255,0.8) 0%, rgba(245,245,250,0.8) 100%);
    z-index: 1;
}

.message {
    display: flex;
    flex-direction: column;
    margin-bottom: 15px;
    max-width: 85%;
    width: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
}

.message.system {
    align-self: flex-start;
}

.message-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
    padding: 0 10px;
    font-size: 12px;
}

/* 添加用户图标样式 */
.user .message-header {
    color: #4CAF50;
    text-align: right;
    justify-content: flex-end;
}

.user .message-header::after {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('/static/icon/usericon.png');
    background-size: cover;
    margin-left: 5px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* 修改系统消息样式，使用蓝色背景 */
.system .message-content {
    background-color: #f0f7ff;
    border-bottom-left-radius: 5px;
    align-self: flex-start;
    color: #333;
    border-left: 3px solid #1976D2;
}

/* 确保文本内容不重复背景框 */
.text-message {
    color: #333;
    background-color: transparent !important;
    border-radius: 0 !important;
    border-left: none !important;
    padding: 0 !important;
}

/* 调整菜单样式以配合蓝色主题 */
.menu-result {
    background-color: #f8fbff;
    border-radius: 12px;
    padding: 15px;
    width: 100%;
    /* border-left: 3px solid #1976D2; */
    margin-top: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.menu-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #1976D2;
}

.menu-description {
    font-size: 14px;
    color: #555;
    margin-bottom: 15px;
    line-height: 1.5;
}

.menu-button {
    display: inline-block;
    background-color: #1976D2;
    color: white;
    padding: 10px 20px;
    border-radius: 24px;
    text-decoration: none;
    font-size: 14px;
    text-align: center;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(25, 118, 210, 0.2);
    transition: all 0.2s ease;
}

.menu-button:hover, .menu-button:active {
    background-color: #1565C0;
    box-shadow: 0 3px 8px rgba(25, 118, 210, 0.3);
}

/* 输入容器固定在底部 */
.input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px)); /* 适配全面屏底部 */
    box-shadow: 0 -1px 4px rgba(0,0,0,0.05);
    z-index: 2;
}

/* 语音输入区域样式 */
.voice-input-area {
    flex: 1;
    height: 44px; /* 与键盘按钮高度一致 */
    margin-right: 10px;
    background-color: #f5f5f5;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    border: 1px solid #eaeaea;
    transition: all 0.2s ease;
}

.voice-input-area:active {
    background-color: #e6e6e6;
}

.voice-input-area.recording {
    background-color: #FFE0E0;
    /* 移除了 animation: pulse 1.5s infinite; */
}

.voice-icon-container {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.voice-prompt-text {
    color: #E53935;
    font-size: 15px;
    text-align: center;
    font-weight: 500;
    margin-left: 18px; /* 为左侧图标留出空间 */
}

/* 键盘切换按钮样式 */
.keyboard-toggle, .voice-toggle {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background-color: #f2f2f2;
    border: none;
    color: #666;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.keyboard-toggle:hover, .voice-toggle:hover {
    background-color: #e0e0e0;
}

/* 文本输入区容器 */
.text-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    margin: 0 10px;
    position: relative;
}

/* 调整文本输入框样式 */
textarea {
    flex: 1;
    height: 44px;
    max-height: 80px;
    padding: 12px 45px 12px 15px;
    border: 1px solid #ddd;
    border-radius: 22px;
    resize: none;
    font-size: 15px;
    outline: none;
    transition: border-color 0.2s ease;
    background-color: #f5f5f5;
    overflow-y: hidden;
}

textarea:focus {
    border-color: #1976D2;
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

/* 发送按钮样式 */
.send-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: #1976D2;
    border: none;
    color: white;
    font-size: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    flex-shrink: 0;
    position: absolute;
    right: 4px;
    box-shadow: 0 2px 5px rgba(25, 118, 210, 0.3);
}

.send-button:hover {
    background-color: #1565C0;
}

/* 输入图标样式 */
.input-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

/* 底部按钮样式 */
.bottom-button {
    background: none;
    border: none;
    color: #666;
    font-size: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
}

.bottom-button i {
    font-size: 22px;
    margin-bottom: 3px;
}

/* 录音指示器 */
.recording-indicator {
    display: none;
    position: fixed; /* 改为固定定位 */
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 12px;
    flex-direction: column;
    align-items: center;
    z-index: 1000; /* 确保显示在最上层 */
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.recording-indicator.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.recording-dots {
    display: flex;
    margin-bottom: 10px;
}

.recording-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: white;
    margin: 0 3px;
    animation: pulse 1.5s infinite;
}

.recording-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.recording-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

.recording-text {
    font-size: 14px;
    font-weight: 500;
}

.loading {
    display: inline-block;
    margin-left: 5px;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 加载指示器样式优化 */
.loading-message .loading {
    display: inline-block;
    margin-left: 5px;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(0, 0, 0, 0.2);
    border-top-color: #1976D2;
    border-radius: 50%;
    animation: spin 1s infinite linear;
}

/* 快捷功能按钮样式 */
.quick-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
    justify-content: center;
}

.quick-button {
    background-color: #f0f7ff;
    border: 1px solid #d0e5ff;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: #1976D2;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.quick-button:hover, .quick-button:active {
    background-color: #e0f0ff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* 自定义开场白样式 */
.welcome-message {
    color: #333;
}

.welcome-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #1976D2;
}

@keyframes pulse {
    0% { transform: scale(0.8); opacity: 0.5; }
    50% { transform: scale(1.2); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.5; }
}

/* 点赞和踩按钮样式 */
.feedback-buttons {
    display: flex;
    justify-content: flex-end;
    margin-top: 8px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.message.system:hover .feedback-buttons {
    opacity: 1;
}

.feedback-button {
    background: none;
    border: none;
    padding: 4px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    transition: background-color 0.2s ease;
}

.feedback-button:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.feedback-button img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.feedback-button.active {
    background-color: rgba(25, 118, 210, 0.1);
}

/* 菜单结果内的反馈按钮 */
.menu-result .feedback-buttons {
    margin-top: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* 添加agent图标样式 */
.system .message-header {
    color: #2196F3;
    justify-content: flex-start;
}

.system .message-header::before {
    content: '';
    display: inline-block;
    width: 24px;
    height: 24px;
    background-image: url('/static/icon/agent.png');
    background-size: cover;
    margin-right: 5px;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    display: inline-block;
    word-break: break-word;
    max-width: 100%;
    width: auto;
    line-height: 1.4;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.user .message-content {
    background-color: #E3F2FD;
    color: #0D47A1;
    border-bottom-right-radius: 5px;
    align-self: flex-end;
}

/* 加载中消息的样式 */
.loading-message {
    background-color: #f0f7ff;
    border-radius: 18px;
    border-bottom-left-radius: 5px;
    /* border-left: 3px solid #1976D2; */
} 